﻿<%@  EnableViewState="false" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="FiltroMultiploGridview._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>teste gridview</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="scmPadrao" EnablePartialRendering="true" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="upp" runat="server">
        <ContentTemplate>
            <asp:GridView ID="gvProdutos" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID"
                DataSourceID="sqlProdutos" EnableModelValidation="True" 
                OnRowDataBound="gvProdutos_RowDataBound" AllowPaging="True" onrowcreated="gvProdutos_RowCreated" 
                >
                <Columns>
                    <asp:TemplateField HeaderText="Name" SortExpression="Name">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            <asp:Label ID="Label2" runat="server" Text="Produto"></asp:Label>
                            <asp:DropDownList ID="ddlNomes" runat="server" AutoPostBack="True" 
                                AppendDataBoundItems="True" DataSourceID="sqlProdutos" DataTextField="Name" 
                                DataValueField="Name">
                                <asp:ListItem Value="Todos">Todos</asp:ListItem>
                            </asp:DropDownList>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="ProductNumber" HeaderText="ProductNumber" SortExpression="ProductNumber" />
                    <asp:TemplateField HeaderText="Color" SortExpression="Color">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Color") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            <asp:Label ID="Label3" runat="server" Text="Color"></asp:Label>
                            <asp:DropDownList ID="ddlCores" runat="server" AppendDataBoundItems="True" 
                                AutoPostBack="True" DataSourceID="sqlProdutos" DataTextField="Color" 
                                DataValueField="Color">
                                <asp:ListItem>Tudo</asp:ListItem>
                            </asp:DropDownList>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("Color") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="StandardCost" HeaderText="StandardCost" 
                        SortExpression="StandardCost" DataFormatString="{0:c}" />
                    <asp:BoundField DataField="ListPrice" HeaderText="ListPrice" SortExpression="ListPrice" />
                    <asp:BoundField DataField="DaysToManufacture" HeaderText="DaysToManufacture" SortExpression="DaysToManufacture" />
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="sqlProdutos" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>"
                SelectCommand="retornaProdutos" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>
